import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
import { PartialType } from '@nestjs/swagger';
import { Decorator_DtoIsNumber_Base } from '@/common/decorators/dtoIsNumber';

export class Good_Create_Dto {
  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '账号' })
  account: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '密码' })
  password: string;

  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  @ApiProperty({ description: '规格ID' })
  productId: number;

  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  @ApiProperty({ type: 'bigint', description: '账号结束时间' })
  goodEndTime: number;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  @ApiProperty({ description: '座位数', default: 0 })
  seatsNum?: number;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  @ApiProperty({ type: 'bigint', description: '账号开始时间', default: 'Date.now()' })
  goodStartTime?: number;
}

export class Good_Find_Dto {
  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  size?: number;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  page?: number;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  @ApiProperty({ description: '商品ID' })
  platformId?: number;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  @ApiProperty({ description: '规格ID' })
  productId?: number;

  @IsString()
  @IsOptional()
  @ApiProperty({ description: '账号' })
  account?: string;
}

export class Good_Update_Dto extends PartialType(Good_Create_Dto) {
  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  id: number;
}
